package MainPage;
import java.awt.event.*;
import java.text.*;
import java.util.*;
import javax.swing.*;

import MainPage.firstPage.DateUtils;
 

public class date extends JButton
{
    
    private static final DateFormat DATE_FORMAT = new SimpleDateFormat("dd-MMM-yy");
 

    private static final calendarGUI DATE_CHOOSER = new calendarGUI();
 

    private Date date,eventDate;
    
    String date1=calendarGUI.combineDateOut,currentDate=DateUtils.DATE_FORMAT_date;
    DateFormat df=new SimpleDateFormat("dd-MMM-yyyy");
    Date newDate;

    protected void fireActionPerformed( ActionEvent e ) {
	myCalendar();
//	try {
//		//newDate = df.parse(firstPage.DateUtils.DATE_FORMAT_date);
//		newDate=df.parse(calendarGUI.combineDateOut);
//		System.out.println(date1);
//	} catch (ParseException e2) {
//		// TODO Auto-generated catch block
//		e2.printStackTrace();
//	}
//	if ( newDate == null )
//	    return;
//	if (date1==null)
//	{
//	   setDate( newDate );
//	System.out.println("fdsafdsa");}
//	else 
//	{
//		try {
//			eventDate = df.parse(calendarGUI.combineDateOut);
//		} catch (ParseException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		}
//		setDate(eventDate);
//	}
    }
 
    public void myCalendar()
	{
		calendarGUI calender_page=new calendarGUI()
		{
			public String getParameter(String name)
			{
		           if (name.equalsIgnoreCase("msg"))
		           {
		              return "Local Frame";
		           }
		           return null;
		    }
		};
		//calender_page.setSize(userMainPage.screensize.width,userMainPage.screensize.height);
		calender_page.setVisible(true);
	}
    
    public date( Date date ) {
	super( DATE_FORMAT.format(date) );
	this.date = date;
    }
 
 
    public date() {
	this( new Date() );
    }
 
 
    public Date getDate() {
	return date;
    }
 
 
    public void setDate( Date date ) {
	Date old = this.date;
	this.date = date;
	//setText( DATE_FORMAT.format(date) );
	setText(df.format(newDate).toString());
	firePropertyChange( "date", old, date );
    }
}
